//
//  ViewController.m
//  24_加密
//
//  Created by 徐昊 on 16/8/16.
//  Copyright © 2016年 徐昊. All rights reserved.
//

#import "ViewController.h"
#import "NSString+HXMD5.h"
#import "NSString+XHSHA_1.h"
#import "NSString+HXBase64.h"
#import "NSString+HXDES.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    // MD5 SHA-1 单项散列函数
    // 1. MD5 验证算法, 一般应用于验证密码
    NSString *afterMD5 = @"Hello";
    NSString *final32BtMD5Lower = [afterMD5 stringWith32BitMD5Lower];
    NSString *final32BtMD5Upper = [afterMD5 stringWith32BitMD5Upper];
    NSString *final16BtMD5lower = [afterMD5 stringWith16BitMD5Lower];
    NSString *final16BtMD5Upper = [afterMD5 stringWith16BitMD5Upper];
    NSLog(@"32bit 小写%@", final32BtMD5Lower);
    NSLog(@"32bit 大写%@", final32BtMD5Upper);
    NSLog(@"16bit 小写%@", final16BtMD5lower);
    NSLog(@"16bit 大写%@", final16BtMD5Upper);
    // 2. SHA_1
    NSString *afterSHA_1 = @"HELLO";
    NSString *finalSHA_1String = [afterSHA_1 stringWithSHA_1];
    NSLog(@"%@", finalSHA_1String);
    // 3. Base64
    NSString *afterBase64 = @"HELLO";
    NSString *base64 = [afterBase64 stringWithBase64];
    NSLog(@"base64 : %@", base64);
    NSString *finalString = [base64 base64WithString];
    NSLog(@"%@", finalString);
    // 4. 对称密码
    // 三种算法 DES 三重DES AES
    NSString *string = @"123";
    NSString *desString = [string stringWithDES];
    NSLog(@"desString: %@", desString);
    NSString *desSourceString = [desString DESWithString];
    NSLog(@"%@", desSourceString);
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
